<!DOCTYPE html>
<html>
<head>
    <title>Gua框架流式处理示例</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="css/streaming_api.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>🌊 Gua框架流式处理示例</h1>
            <p>基于Linus设计哲学的极简流式处理框架</p>
        </header>
        
        <main>
            <div class="demo-grid">
                <div class="demo-card">
                    <h3>🔢 数字流</h3>
                    <p>基础流式响应，每500ms显示一个数字</p>
                    <button onclick="testStream('/stream', 'stream')">开始数字流</button>
                    <div class="status" id="streamStatus">准备就绪</div>
                    <div class="output" id="streamOutput"></div>
                </div>
                
                <div class="demo-card">
                    <h3>⚡ 快速流</h3>
                    <p>快速流式响应，每200ms显示一个数字</p>
                    <button onclick="testStream('/quick-stream', 'quick')">开始快速流</button>
                    <div class="status" id="quickStatus">准备就绪</div>
                    <div class="output" id="quickOutput"></div>
                </div>
                
                <div class="demo-card">
                    <h3>💬 AI对话</h3>
                    <p>模拟AI逐字输出，每个字符随机延迟</p>
                    <button onclick="testChat()">开始AI对话</button>
                    <div class="status" id="chatStatus">准备就绪</div>
                    <div class="output" id="chatOutput"></div>
                </div>
                
                <div class="demo-card">
                    <h3>📡 SSE事件</h3>
                    <p>服务器发送事件，实时推送多种事件类型</p>
                    <button onclick="testEvents()">开始事件流</button>
                    <div class="status" id="eventsStatus">准备就绪</div>
                    <div class="output" id="eventsOutput"></div>
                </div>
            </div>
        </main>
        
        <footer>
            <p>🚀 基于ASGI的高性能流式处理 | 🎯 零配置开箱即用 | 🛡️ 生产级稳定性</p>
        </footer>
    </div>

    <script src="js/streaming_api.js"></script>
</body>
</html>